package org.yawnage.interfaces.database 
{
	import flash.data.SQLConnection;
	import flash.data.SQLResult;
	import flash.data.SQLStatement;
	
	 /**
	 * <p>//TODO:To be written</p>
	 * @author Berry Jordaan
	 * @date 2011/09/09 04:16 PM
	 * @copyright Copyright © Berry/James 2011
	 * @version 1.0.0.0
	 * @description
	 * @history Berry Jordaan on 2011/09/09 04:16 PM: Created
	 */
	
	public interface IDatabase 
	{
		/**
		 * Need to call open before making queries!
		 * @return SQLConnection connection
		 */
		function open(dbName:String):SQLConnection;

		/**
		 * Close the connection to the DB
		 */
		function close():void;
		
		/**
		 * Reset the database, clear all data and recreate the tables.
		 */
		function clear():void;
		
		/**
		 * An DataBaseEvent is fired when the result is returned.
		 * @param	query
		 */
		function getData(query:String):SQLResult; 

		/**
		 * 
		 * @param	query
		 * @return true if the inserWas successfull
		 */
		function runQuery(query:String):SQLStatement;

		/**
		 * Reset the table
		 * @param	tableName table name
		 */
		function resetTable(tableName:String):void;

		/**
		 * Database name
		 */
		function get databaseName():String;
	}
	
}